<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/content/mytags.jsp"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>用户 </title>
		<t:resource types="jquery,lhgdialog,easyui" />
		<script type="text/javascript">
			$.extend($.fn.validatebox.defaults.rules, {
				equalTo : {
					validator : function(value, param) {
						return $(param[0]).val() == value;
					},
					message : '两次输入密码不匹配'
				}
			});
		</script>
	</head>
	<body>
		<ui:form name="user-form" refreshGrid="userList" action="user.do?saveOrUpdate">
			<div class="form-group">
				<label class="label">用户账号 :</label>
				<input type="hidden" name="id" id="id" value="${user.id }">
				<c:if test="${empty user.id }">
					<input id="userAccount" type="text" name="userAccount" value="${user.userAccount }" class="easyui-textbox" data-options="required:true,validType:['length[6,32]']" />
				</c:if>
				<c:if test="${!empty user.id }">
					<input id="userAccount" type="text" name="userAccount" value="${user.userAccount }" class="easyui-textbox" data-options="required:true,disabled:true,validType:['length[6,32]']" />
				</c:if>
			</div>
			<div class="form-group">
				<label class="label">用户姓名 :</label>
				<input id="userName" type="text" name="userName" value="${user.userName }" class="easyui-textbox" data-options="required:true,validType:['length[2,32]']" />
			</div>
			<c:if test="${empty user.id }">
				<div class="form-group">
					<label class="label">用户密码 :</label>
					<input id="userPwd" type="password" name="userPwd" value="" class="easyui-textbox" data-options="required:true,validType:['length[6,32]']" />
				</div>
				<div class="form-group">
					<label class="label">重复密码 :</label>
					<input id="repeatUserPwd" type="password" name="repeatUserPwd" value="" class="easyui-textbox" validType="equalTo['#userPwd']" data-options="required:true" />
				</div>
			</c:if>
			<c:if test="${empty user.id }">
				<div class="form-group">
					<label class="label">组织机构 :</label>
					<ui:combogrid name="orgId" idField="id" textField="orgName" action="organization.do?datagrid" width="171" panelWidth="300">
						<ui:column field="id" title="编码" sortable="false" hidden="true" />
						<ui:column field="orgCode" title="组织编码" sortable="false"/>
						<ui:column field="orgName" title="组织名称" sortable="false"/>
					</ui:combogrid>
				</div>
			</c:if>
			<div class="form-group">
				<label class="label">用户状态 :</label>
				<ui:combobox name="state" dictionary="userState" panelHeight="80" setValue="${user.state }" required="true"></ui:combobox>
			</div>
			<div class="form-group">
				<label class="label">备注 :</label>
				<input id="remark" type="text" name="remark" value="${user.remark }" class="easyui-textbox" data-options="multiline:true,height: '80px'"/>
			</div>
		</ui:form>
	</body>
</html>